$(function(){
    $("#form-community-add").Validform({
    tiptype:2,
    ajaxPost:true,
    showAllError:true,
    beforeSubmit:function(curform){
      curform.ajaxSubmit({
        type:'POST',
        url:'/index.php?m=Admin&c=Community&a=add',
        success:function(data){
          if(data.stat==1){
                layer.msg("添加成功");
                var index = parent.layer.getFrameIndex(window.name);
                setTimeout(function(){
                       parent.layer.close(index);
                },1000);
                 parent.location.reload();
          }else{
            layer.msg(data.msg);
          }
        }
        });
      return false;
    }
  });
});